package cn.sy.feignFallback;


import cn.sy.domain.Bom;
import cn.sy.exception.GlobalErrorCodeEnum;
import cn.sy.feign.BomFeignClien;
import cn.sy.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class BomClienFallbackFactory implements FallbackFactory<BomFeignClien> {

    @Override
    public BomFeignClien create(Throwable throwable) {
        return new BomFeignClien() {
            @Override
            public JSONResult saveOrUpdate(Bom bom) {
                return JSONResult.error(GlobalErrorCodeEnum.SERVICE_ERROR);
            }
        };
    }
}
